package arch.async.event;

import arch.domain.archive.ArchiveNumber;
import arch.service.archive.ArchiveNumberService;
import arch.service.archive.ArchiveService;
import arch.util.BeanRepository;

public class SpaceArchiveNumberSynchronizationEvent implements Runnable {
	private String archiveId;
	
	public SpaceArchiveNumberSynchronizationEvent (String archiveId) {
		this.archiveId = archiveId;
	}
	public void run() {
		ArchiveService archiveService = BeanRepository.getBean("archiveService", ArchiveService.class);
		ArchiveNumberService archiveNumberService = BeanRepository.getBean("archiveNumberService", ArchiveNumberService.class);
		
		ArchiveNumber archiveNumber = archiveNumberService.find(archiveId);
		archiveService.setColumnValue(archiveId, "an_serial", archiveNumber.getSerial());
		archiveService.setEntryValue(archiveId, "ArchiveNumber", archiveNumber.getSerial() + "");
	}
}
